

#include "gpio.h"
#include "cpu_io.h"
#include "uart.h"


void uart_init(void)
{
	struct s5pv210_gpio *gpio = (struct s5pv210_gpio *)S5PV10_GPIO_BASE;
	struct s5pv210_uart *uart0 = (struct s5pv210_uart *)S5PV10_UART_BASE;
	unsigned int var;

	var = __REG(&gpio->a0.con);
	var &= ~(0xff);
	var |= 0x22;
	__REG(&gpio->a0.con) = var;

	/*config uart controller*/
	__REG(&uart0->ulcon) = 0x03;	/*8bit, no parity*/
	__REG(&uart0->ucon) = 0x05;	/*Interrupt request or polling mode*/
	__REG(&uart0->ubrdiv) = 35;
	__REG(&uart0->udivslot) = 0x1;
}

void putc(const char c)
{
	struct s5pv210_uart *uart0 = (struct s5pv210_uart *)S5PV10_UART_BASE;

	while(!(__REG(&uart0->utrstat) & (0x1<<2)));

	__REG(&uart0->utxh) = c;
}

